/*
 * @Author: 麦冬果果
 * @Date: 2021-09-08 16:36:39
 * @LastEditTime: 2021-09-09 17:12:34
 * @LastEditors: 麦冬果果
 * @Description: 文件描述Client
 * @FilePath: /svc/src/library/mhttp/client.go
 * 可以输入预定的版权声明、个性签名、空行等
 */
package mhttp

import (
	"github.com/gogf/gf/encoding/gjson"
	"github.com/gogf/gf/frame/g"
)

var Client = client{}

type client struct{}

/**
 * @description:外网post请求
 * @param {string} url 请求地址
 * @param {g.Map} params 请求参数
 * @return {*}
 */
func (c *client) Post(url string, params g.Map) (code int, msg string, data *gjson.Json) {
	cl := g.Client()
	resp := cl.ContentJson().PostContent(
		url,
		params,
	)
	result := gjson.New(resp)
	code = result.GetInt("code")
	msg = result.GetString("msg")
	data = result.GetJson("data")
	return
}
